home *** CD-ROM | disk | FTP | other *** search
- Path: solon.com!not-for-mail
- From: rreed@unconfigured.xvnews.domain (Randy Reed)
- Newsgroups: comp.lang.c,comp.lang.c.moderated,hp.unix,comp.sys.hp.apps,comp.sys.hp.hpux
- Subject: Re: C coding problem
- Date: 6 Apr 1996 09:02:15 -0600
- Organization: The unconfigured xvnews people
- Sender: clc@solutions.solon.com
- Approved: clc@solutions.solon.com
- Message-ID: <4k611n$amg@solutions.solon.com>
- References: <4jv7dk$d1k@solutions.solon.com>
- Reply-To: rreed@unconfigured.xvnews.domain
- NNTP-Posting-Host: solutions.solon.com
-
-
- In article <4jv7dk$d1k@solutions.solon.com>, schwarz@mips.complang.tuwien.ac.at (Konrad Schwarz) writes:
- >In article <4jttlq$3p1@solutions.solon.com>, nsmart@indigo.ie (Niall Smart) writes:
- >
- >|> I would prefer:
- >|>
- >|> >for ( ; p<end_p; p++)
- >|> > ++(*p);
- >|>
- >|> or either of:
- >|>
- >|> while (p < end_p)
- >|> {
- >|> (*p)++;
- >|> p++;
- >|> }
- >|>
- >|> while (p++ < end_p)
- >|> {
- >|> (*p)++;
- >|> }
- >|>
- >|> Zero chance for ambiguity in the last three versions.
- >
- >The third version is not equivalent to the other two.
- >The second version uses up more than twice the screen space of the original.
- >
- >Konrad Schwarz
-
-
- Well Mr. Schwarz, IMHO it is not a matter of taste, but one of priorities.
- Your priority seems to be screen space. Since I can stretch my window
- vertically, and I have more disk storage than I could code in a lifetime,
- my priorities are:
- 1. Code Clarity
- 2. Speed of execution
- 3. Memory Usage
- I realize that I am a minority (probably more so on this newsgroup) but
- if your code sample was delivered to me in a code walkthrough, I would
- reject it because I wouldn't want members of my team to code in that
- fashion.
-
- It appears as if the original discussion was arrays .vs. pointers, and
- to be honest, I prefer arrays for clarity, but would accept either, so
- long as the code is clear-clear-clear. Arrays are easier to monitor if
- you are using a debugger, since the array index variable is easier to
- visualize than an offset from the original address.
-
- Just an opinion, but it's the only one I got.
-
- Randy Reed
-